package com.yihu.cms.action;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yihu.cms.service.ArtworkModelService;
import com.yihu.web.bean.ArtworkModel;
import com.yihu.web.bean.vo.ArtworkQuery;
/***
 * 艺术品款式管理
 * @author Aaron
 *
 */
@Controller
public class ArtworkModelController extends BaseController{
	private final Logger logger = LoggerFactory.getLogger(ArtworkModelController.class); 
	ArtworkModelService service = new ArtworkModelService();
	
	@RequestMapping(value = "/artworkModel", method = RequestMethod.POST)
	public @ResponseBody Object add(@RequestBody ArtworkModel a) {
		return service.addArtworkModel(a);
	}
	
	@RequestMapping(value = "/artworkModel/{id}", method = RequestMethod.PUT)
	public @ResponseBody Object updatePoster(@RequestBody ArtworkModel a,@PathVariable("id") String id) {
		a.setId(id);
		return service.updateArtworkModel(a);
	}
	
	@RequestMapping(value = "/artworkModel/{id}", method = RequestMethod.DELETE)
	public @ResponseBody Object delete(@PathVariable("id") String id) {
	
		return service.delArtworkModel(id);
	}
	
	@RequestMapping(value = "/artworkModel/list" , method = RequestMethod.GET)
	// , method = RequestMethod.PATCH
	public @ResponseBody Object getArtworkModels(ArtworkQuery query) {
		logger.debug("getArtworkModels: "+query);
		return service.getArtworkModels(query);
	}
	
	@RequestMapping(value = "/artworkModel/{id}", method = RequestMethod.GET)
	public @ResponseBody Object findArtworkModel(@PathVariable("id") String id) {
		return service.findArtworkModel(id);
	}
	
}
